﻿using LJX.SmartPark.Common.ResponseOutput;
using LJX.SmartPark.Domain.LogManage;
using LJX.SmartPark.Service.LogManage.Login;
using LJX.SmartPark.Service.LogManage.Operation;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace LJX.SmartPark.WebApi.Controllers.LogManage
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    [ApiExplorerSettings(GroupName = "LogManage")]
    public class LogManageController : ControllerBase
    {
        //登录日志
        private readonly ILoginLogServeice loginLogServeice;

        //操作日志
        private readonly IOperationLogServeice operationLogServeice;

        public LogManageController(ILoginLogServeice loginLogServeice, IOperationLogServeice operationLogServeice)
        {
            this.loginLogServeice = loginLogServeice;
            this.operationLogServeice = operationLogServeice;
        }

        #region 登录日志

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public Response<List<LoginLog>> GetLoginLogAsync(Lmodel lmodel)
        {
            var result = loginLogServeice.GetLoginLog(lmodel);
            return result.Result;
        }

        #endregion

        #region 操作日志

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public Response<List<OperationLog>> GetOperationLogAsync(Omodel omodel)
        {
            var result = operationLogServeice.GetOperationLog(omodel);
            return result.Result;
        }

        #endregion
    }
}
